package com.mytaobao.main.weitao.dongtai;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;

import com.baseproject.mvp.MvpFragment;
import com.mytaobao.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hp on 2017/3/31.
 */

public class DongTaiFragment extends MvpFragment<DongTaiFragment, DongTaiPresenter>
        implements DongTaiContract.IDongTaiView {

    private RecyclerView list;
    private List<ItemDongTai> mData = new ArrayList<ItemDongTai>();

    public void initData(){
//        newsListDao = new NewsListDao(getActivity());
//        mData = newsListDao.list(newsType);
//        if (mData.size() == 0){
//            onRefresh();
//        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_weitao_first;
    }


    @NonNull
    @Override
    public DongTaiPresenter createPresenter() {
        return new DongTaiPresenter();
    }

    @Override
    protected void _onCreateView(View view, ViewGroup container, Bundle savedInstanceState) {
        list = (RecyclerView) view.findViewById(R.id.pull_refresh_list);
        initData();
        list.setLayoutManager(new LinearLayoutManager(this.getContext()));
        list.setAdapter(new DongTaiRecyclerViewAdapter(this.getContext(),
                new ArrayList<ItemDongTai>() {{ add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());
                    add(new ItemDongTai()); add(new ItemDongTai()); add(new ItemDongTai());}}));
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return false;
    }

    @Override
    public void setDongTais(List<ItemDongTai> dongTais) {

    }
}
